package com.seleniti.enpareja.controller.ui.view;

import org.ioc.commons.flowcontrol.actioncontroller.IsExternalAction;
import org.ioc.commons.flowcontrol.eventbus.IsEvent;
import org.ioc.commons.flowcontrol.operationmanager.IsOperation;
import org.ioc.commons.ui.HasEnabled;
import org.ioc.commons.ui.HasLoader;
import org.ioc.commons.ui.HasValue;
import org.ioc.commons.ui.HasVisibility;
import org.ioc.commons.ui.IsView;
import org.ioc.commons.ui.IsViewPresenter;
import org.ioc.commons.ui.features.Info;

import com.seleniti.enpareja.controller.control.place.EnParejaPlace;

public interface LoginView extends EnParejaView<LoginView.Event, LoginView.Operation, LoginView.Action> {
	@interface Fires {
		LoginView.Event[] value();
	}

	@interface Invokes {
		LoginView.Action[] value();
	}

	@interface Performs {
		LoginView.Operation[] value();
	}

	public enum Event implements IsEvent {
		LoginOk, LoginFail
	}

	public enum Operation implements IsOperation {
		TryingLogin, GettingWorkareas,
	}

	public enum Action implements IsExternalAction {
	}

	public interface Presenter extends IsViewPresenter {
		@Fires({Event.LoginOk, Event.LoginFail})
		@Performs({Operation.TryingLogin})
		void onTryLogin();

		void onGoToSignUpView();

		void onGoToGoogleLoginView();

		void onGoToDownloadAppView();

		void onGoToSolveNoPasswordSetView();
	}
	
	public enum Board {
		STANDARD_LOGIN, ANDROID_LOGIN;
	}
	
	HasValue<String> loginName();
	
	HasValue<String> loginPassword();
	
	HasValue<Boolean> rememberMe();
	
	Info loginFailed();

	@Fires({Event.LoginOk, Event.LoginFail})
	@Performs({Operation.TryingLogin})
	void tryLogin();

	HasLoader tryingLogin();
	
	HasEnabled actionsEnabled();
	
	HasValue<Board> board();

	void goToSignUpView();

	void goToGoogleLoginView();

	void focusLoginFailed();

	void goToDownloadAppView();

	void setGoToPlaceWhenOk(EnParejaPlace goWhenOk);
	
	EnParejaPlace getGoToPlaceWhenOk();

	HasVisibility downloadAppButtonVisibility();

	HasVisibility infoSolveNoPasswordSet();
	
}
